<hornetq:binding.hornetq> <swyd:operationSelector operationName="greet" xmlns:swyd="urn:switchyard-config:switchyard:1.0"/> (... snip ...) </hornetq:binding.hornetq>
OperationSelector provides a capability to determine which service operation should be invoked for the message exchange. The following options are available. If the target service only has a single operation, this setting is optional.
specify a operation name in the configuration.
<hornetq:binding.hornetq> <swyd:operationSelector operationName="greet" xmlns:swyd="urn:switchyard-config:switchyard:1.0"/> (... snip ...) </hornetq:binding.hornetq>
specify a XPath location which contains a operation name to be invoked in the message contents.
If the configuration looks like this:
<jca:binding.jca> <swyd:operationSelector.xpath expression="//person/language" xmlns:swyd="urn:switchyard-config:switchyard:1.0"/> (... snip ...) </jca:binding.jca>
And the message content is like this:
<person> <name>Fernando</name> <language>spanish</language> </person>
Then operation spanish() would be invoked.
specify a Regular Expression to find a operation name to be invoked in the message contents.
If the configuration looks like this:
<http:binding.http> <swyd:operationSelector.regex expression="[a-zA-Z]*Operation" xmlns:swyd="urn:switchyard-config:switchyard:1.0"/> (... snip ...) </http:binding.http>
And the message content is like this:
xxx yyy zzz regexOperation aaa bbb ccc
Then operation regexOperation() would be invoked.
specify a Java class which is able to determine the operation to be invoked.
configuration should look like this:
<jca:binding.jca> <swyd:operationSelector.java class="org.switchyard.example.MyOperationSelectorImpl" xmlns:swyd="urn:switchyard-config:switchyard:1.0"/> (... snip ...) </jca:binding.jca>
Note that the org.switchyard.example.MyOperationSelectorImpl needs to implement org.switchyard.selector.OperationSelector or other concrete OperationSelector classes for each service bindings. You can override the selectOperation() method as you like.
Default OperationSelector implementation for each service bindings are following:
Camel : org.switchyard.component.camel.selector.CamelOperationSelector
JCA/JMS : org.switchyard.component.jca.selector.JMSOperationSelector
JCA/CCI : org.switchyard.component.jca.selector.CCIOperationSelector
HTTP : org.switchyard.component.http.selector.HttpOperationSelector
Support for operation selector is limited to Camel, JCA and HTTP service bindings. Support for other service bindings will be added in the future.